package com.woate.wingframework.persistent.api.executor;

import com.woate.wingframework.persistent.api.BatchResult;
import com.woate.wingframework.persistent.api.ResultHandler;
import com.woate.wingframework.persistent.api.RowBounds;
import com.woate.wingframework.persistent.api.exceptions.PersistentException;
import com.woate.wingframework.persistent.api.mapping.MappedStatement;
import com.woate.wingframework.persistent.api.transaction.Transaction;

import java.util.List;

public interface Executor {

  ResultHandler NO_RESULT_HANDLER = null;

  int update(MappedStatement ms, Object parameter) throws PersistentException;

  <E> List<E> query(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler) throws PersistentException;

  List<BatchResult> flushStatements() throws PersistentException;

  void commit(boolean required) throws PersistentException;

  void rollback(boolean required) throws PersistentException;

  Transaction getTransaction();

  void close(boolean forceRollback);

  boolean isClosed();

  void setExecutorWrapper(Executor executor);

}